package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 项目信息
 */
@TableName("t_project_info")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.ProjectInfoMapper")
public class ProjectInfoDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 交易中心编码
     */
    @TableField(value = "center_id")
    private Long centerId;

    /**
     * 机构编码
     */
    @TableField(value = "org_id")
    private Long orgId;

    /**
     * 招标项目编号
     */
    @TableField(value = "project_code")
    private String projectCode;

    /**
     * 招标项目名称
     */
    @TableField(value = "project_name")
    private String projectName;

    /**
     * 标段编号
     */
    @TableField(value = "section_code")
    private String sectionCode;

    /**
     * 标段名称
     */
    @TableField(value = "section_name")
    private String sectionName;

    /**
     * 合同估算价格
     */
    @TableField(value = "contract_reckon_price")
    private Long contractReckonPrice;

    /**
     * 招标商名称
     */
    @TableField(value = "tenderer")
    private String tenderer;

    /**
     * 招标商统一社会信用代码
     */
    @TableField(value = "tenderer_credit_code")
    private String tendererCreditCode;

    /**
     * 招标人银行开户行
     */
    @TableField(value = "tenderer_bank_openbank")
    private String tendererBankOpenbank;

    /**
     * 招标人银行账户名称
     */
    @TableField(value = "tenderer_bank_account")
    private String tendererBankAccount;

    /**
     * 招标人银行账号
     */
    @TableField(value = "tenderer_bank_code")
    private String tendererBankCode;

    /**
     * 招标人联系人
     */
    @TableField(value = "tenderer_contact")
    private String tendererContact;

    /**
     * 招标人联系人电话
     */
    @TableField(value = "tenderer_contact_tel")
    private String tendererContactTel;

    /**
     * 城市编码
     */
    @TableField(value = "city_code")
    private String cityCode;

    /**
     * 招商项目类型
     */
    @TableField(value = "tender_project_type")
    private String tenderProjectType;

    /**
     * 开标时间
     */
    @TableField(value = "bid_open_time")
    private Date bidOpenTime;

    /**
     * 有效期限
     */
    @TableField(value = "valid_period")
    private Integer validPeriod;

    /**
     * 投标保证金
     */
    @TableField(value = "bid_bond")
    private Long bidBond;

    /**
     * 招标方通知地址
     */
    @TableField(value = "tender_notice_url")
    private String tenderNoticeUrl;

    /**
     * 招标方文件地址
     */
    @TableField(value = "tender_file_url")
    private String tenderFileUrl;

    /**
     * 招标方文件md5校验值
     */
    @TableField(value = "tender_file_md5")
    private String tenderFileMd5;

    /**
     * 备注说明
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 预警标识0正常 1出函机构无法受理该项目
     */
    @TableField(value = "warn_flag")
    private Integer warnFlag;

    /**
     * 信息来源0自动 1手动
     */
    @TableField(value = "source_flag")
    private Integer sourceFlag;

    /**
     * 投标截止时间
     */
    @TableField(value = "bid_indate")
    private Date bidIndate;

    /**
     * 项目发布日期
     */
    @TableField(value = "notice_pub_date")
    private Date noticePubDate;

    /**
     * 受益人地址
     */
    @TableField(value = "tenderer_address")
    private String tendererAddress;

    /**
     * 模板主键id
     */
    @TableField(value = "template_id")
    private Long templateId;
    /**
     * 招标文件发布时间
     */
    @TableField(value = "tenderer_date")
    private Date tendererDate;

    /**
     * 密文
     */
    @TableField(value = "ciphertext")
    private String ciphertext;

    /**
     * 项目计划工期
     */
    @TableField(value = "project_days")
    private String projectDays;
    /**
     * 项目建设地址
     */
    @TableField(value = "project_address")
    private String projectAddress;
    /**
     * 招标类型（施工、勘察、设计等）
     */
    @TableField(value = "invite_type")
    private String inviteType;

    /**
     * 项目加密标识 1：密文 2明文
     */
    @TableField(value = "project_encryption_flag")
    private Integer projectEncryptionFlag;

    /**
     * 二级分类 01:建筑工程、02:交通工程、03:水务工程、04:其他工程
     */
    @TableField(value = "second_category_code")
    private String secondCategoryCode;

    public ProjectInfoVo buildVo() {
        return new ProjectInfoVo(id, centerId, orgId, projectCode, projectName, sectionCode, sectionName, contractReckonPrice, tenderer, tendererCreditCode, tendererBankOpenbank, tendererBankAccount, tendererBankCode, tendererContact, tendererContactTel, cityCode, tenderProjectType, bidOpenTime, validPeriod, bidBond, tenderNoticeUrl, tenderFileUrl, tenderFileMd5, remark, gmtCreate, gmtModified, userCreate, userModified, warnFlag, sourceFlag, bidIndate, noticePubDate, tendererAddress, templateId, tendererDate, ciphertext, projectDays, projectAddress, inviteType, projectEncryptionFlag,secondCategoryCode);
    }

    public static ProjectInfoDO of(ProjectInfoVo vo) {
        return new ProjectInfoDO(vo.getId(), vo.getCenterId(), vo.getOrgId(), vo.getProjectCode(), vo.getProjectName(), vo.getSectionCode(), vo.getSectionName(), vo.getContractReckonPrice(), vo.getTenderer(), vo.getTendererCreditCode(), vo.getTendererBankOpenbank(), vo.getTendererBankAccount(), vo.getTendererBankCode(), vo.getTendererContact(), vo.getTendererContactTel(), vo.getCityCode(), vo.getTenderProjectType(), vo.getBidOpenTime(), vo.getValidPeriod(), vo.getBidBond(), vo.getTenderNoticeUrl(), vo.getTenderFileUrl(), vo.getTenderFileMd5(), vo.getRemark(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getWarnFlag(), vo.getSourceFlag(), vo.getBidIndate(), vo.getNoticePubDate(), vo.getTendererAddress(), vo.getTemplateId(), vo.getTendererDate(), vo.getCiphertext(), vo.getProjectDays(), vo.getProjectAddress(), vo.getInviteType(),vo.getProjectEncryptionFlag(),vo.getSecondCategoryCode());
    }
}
